#!/usr/bin/python
#sometimes there are less mol2 files than lines in the score-table => delete these lines

import os, sys

score_file = open(sys.argv[1], 'r')
new_score_file = open(sys.argv[2], 'w')

files = os.listdir('./')

list = []

for i in files:
	#print i[-4:]
	if i[-4:] == 'mol2':
		list.append(i[:-5])
		#print i[:-4]

for i in score_file.xreadlines():
	values = i.split('\t')
	label = values[0]
	#print values
	#print label
	if label in list:
		new_score_file.write(i)
		list.remove(label)

print list

new_score_file.close()
score_file.close()

	
	
